module.exports=function(acc,err){
//1. 安装 mongoose
//2. 导入 mongoose
const mongoose = require('mongoose');
const config=require('../config/config')
mongoose.set('strictQuery',true)
//3. 连接数据库
mongoose.connect(`mongodb://${config.address}:${config.port}/${config.dbName}`)
//回调函数
mongoose.connection.once('open',()=>{
	acc()
})
mongoose.connection.on('error', () => {
	err()
})
//连接关闭
mongoose.connection.on('error', () => {
	console.log('连接出错')
})
}